<!doctype html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<link rel="stylesheet" href="../res/css/weui.css"/>
<link rel="stylesheet" href="../res/css/weuix.css"/>
<script src="../res/js/zepto.min.js"></script>
<script src="../res/js/zepto.weui.js"></script>
<script src="../res/js/common.js?v=5"></script>

<script>
    var patientList;
    var inquiry_patient_id, inquiry_patient_img, inquiry_curr_date;



    function doSavePat() {
        var inquiry_patient_name, inquiry_patient_sex, inquiry_patient_age, ddl_drug_allergy, log_source;
        inquiry_patient_name = $('#txt_patient_name').val();
        if (isEmpty(inquiry_patient_name)) {
            msgInfo('请输入就诊人姓名');
            return;
        }
		inquiry_patient_sex = $('#ddl_sex_code').val();
		if (isEmpty(inquiry_patient_sex)) {
		    msgInfo('请选择性别');
		    return;
		}
		inquiry_patient_age = $('#txt_patient_age').val();
		if (isEmpty(inquiry_patient_age)) {
		    msgInfo('请输入年龄');
		    return;
		}

		ddl_drug_allergy = $('#txt_allergy_details').val();
		if (isEmpty(ddl_drug_allergy)) {
		    msgInfo('请确认有无过敏史');
		    return;
		}
        // if (!$('#weuiAgree').attr('checked')) {
        //     msgInfo('请先了解并勾选协议');
        //     return;
        // }
        inquiry_patient_weight = $('#txt_patient_weight').val();
        if (isEmpty(inquiry_patient_weight))
            inquiry_patient_weight = 0;
        if (isUndefinedAndEmpty(hospital_id))
            hospital_id = getUserInfo().hospital_id;
        log_source = (user_type == 1 ? '个人' : getUserInfo().store_name);
        localStorage.setItem("user_name_" + user_id, inquiry_patient_name);
        var paramJson = {
            "inquiry_patient_id": inquiry_patient_id, //患者id
            "hospital_id": hospital_id, //	医院id
            "user_type": user_type, //用户类型 1用户 2门店
            "user_id": user_id, //用户ID
            "inquiry_patient_type": 1, //问诊类型 0为自己问诊 1为他人问诊
            "inquiry_patient_img": inquiry_patient_img, //头像
            "inquiry_patient_name": inquiry_patient_name, //姓名
            // "inquiry_patient_idcard": inquiry_patient_idcard, //身份证
            "inquiry_patient_sex": inquiry_patient_sex, //性别 0男 1女
            // "inquiry_patient_birthday": inquiry_patient_birthday, //出生日期 1995-08-01
            "inquiry_patient_phone":  $('#txt_patient_phone').valueOf()(), //手机号
			"patientAge":inquiry_patient_age,
            // "is_married":  $('#ddl_married').val(), //是否已婚 0否 1是
            // "inquiry_patient_marital_status":  $('#txt_patient_jg').val(), //籍贯
            "inquiry_patient_weight": $('#txt_patient_weight').text(), //体重
            "inquiry_patient_profession_code": 13, //职业
            "inquiry_patient_profession": $('#ddl_patient_profession').text(), //职业
            // "inquiry_patient_address": $('#txt_address').val(), //住址
            "is_drug_allergy": 1, //是否药物过敏 .0否 1是
            "iinquiry_patient_allergy_details": ddl_drug_allergy, //药物过敏史
            "doctor_id": getQst('doctor_id'), //医生id
            "log_source": log_source, //个人/门店名称
            "log_type": getQst('log_type'),//记录类型 1视频问诊 2图文问诊
        }
        ajaxPost("userSide_personal_inquiry_addInquiryPatientInfo", paramJson, doSavePatSuccess);
    }

    function doSavePatSuccess(jsonInfo) {
        if (jsonInfo.code == '200') {
            var data = jsonInfo.data;
			console.log(data)
			var hospital_id = getQst("hospital_id");
            // goPage('inquiry_chatwait.htm?log_id=' + data.log_id + '&doctor_id=' + data.doctor_id + '&log_type=' + data.log_type+ '&hospital_id=' + hospital_id);
            //window.location = path_url + 'util_toUserInterrogation.do?log_id=' + data.log_id + '&doctor_id=' + data.doctor_id + '&log_type=' + data.log_type
        }
        else
            msgInfo(jsonInfo.info);
    }

    function range(r, a, N) { var i, o, s = [], e = N || 1, f = !1; if (isNaN(r) || isNaN(a) ? isNaN(r) && isNaN(a) ? (f = !0, i = r.charCodeAt(0), o = a.charCodeAt(0)) : (i = isNaN(r) ? 0 : r, o = isNaN(a) ? 0 : a) : (i = r, o = a), !(i > o)) for (; i <= o; ) s.push(f ? String.fromCharCode(i) : i), i += e; else for (; i >= o; ) s.push(f ? String.fromCharCode(i) : i), i -= e; return s }



    $(function () {
        inquiry_patient_id = "";
        inquiry_patient_img = "";
        checkLogin();
 
		$('#txt_patient_name').change(function(){
			if($('#txt_patient_name').val()!=''){
				$('#btnInquiry').removeClass("weui-btn_disabled")
			}
		})
	
        //立即咨询
        $('#btnInquiry').click(function () {
            doSavePat();
        });

        //返回上页
        $('#btnBack').on("click", function () {
            goPageNo(-1);
        });
		
    });
</script>
<style>
body{background-color: #EFF3F4;}
.weui-header-fixed-top{border-bottom:1px solid #e8e8e8; left:0; top:0; right:0; z-index: 1; background:#F6F6F9}
.weui-flex{padding: 0.625rem;}
.weui-cells {margin-top: 0px;}
.weui-form__opr-area{margin: 0 auto; width: 80%;}
.choice{position: relative;}
.choice .radio{position: relative;display: inline-block;font-weight: 400;color: #0c4757;padding-left: 25px;cursor: pointer;}
.choice .radio input{position: absolute;left: -9999px;}
.choice .radio i{display: block;position: absolute;top: 6px;left: 0;width: 15px;height: 15px;outline: 0;border: 1px solid #19BA86;border-radius: 50%;transition: border-color .3s;-webkit-transition: border-color .3s;}
.choice .radio input:checked+i{border-color: #19BA86;}
.choice .radio input+i:after{position: absolute;content: '';top: 3px;left: 3px;width: 9px;height: 9px;border-radius: 50%;background-color: #19BA86;opacity: 0;transition: opacity .1s;-webkit-transition: opacity .1s;}
.choice .radio input:checked+i:after{opacity: 1;}

</style>
</head>

<body ontouchstart>
    <div class="weui-header-fixed-top">
        <div class="weui-header weui-btn_primary"> 
            <div class="weui-header-left"><a id="btnBack" class="icon icon-109 f-white"></a></div>
            <div class="weui-header-title">就诊人详情</div>
            <div class="weui-header-right"></div>
        </div>
    </div>
    <div class="weui-cells weui-cells_form" style="border-top: 10px solid #EFF3F4;">
        <div class="weui-flex">
			请如实填写就诊人信息
		</div>   
        <span style="font-size:14px;margin-left:10px;color: #DC4815;">*请如实填写患者病历信息，带*号为必填。</span>
		
        <div class="weui-form">
			<div class="weui-form__control-area">
				<div class="weui-cells__group weui-cells__group_form">
					
					<div class="weui-cells weui-cells_form">
						<!-- 就诊人 -->
						<div class="weui-cell weui-cell_active">
							<div class="weui-cell__hd"><label class="weui-label">就诊人<span class="f-red">*</span></label></div>
							<div class="weui-cell__bd">
								<input id="txt_patient_name" class="weui-input" placeholder="请输入就诊人姓名"/>
							</div>
						</div>
						<!-- 性别 -->
						<div class="weui-cell weui-cell_active">
							<div class="weui-cell__hd"><label class="weui-label">性&nbsp;&nbsp;&nbsp;别<span class="f-red">*</span></label></div>
							<div class="weui-cell__bd choice" >
								 <label class="radio"><input type="radio" name="radio1" id="ddl_sex_code" value='0'><i></i>男</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								 <label class="radio"><input type="radio" name="radio1" id="ddl_sex_code" value='1'><i></i>女</label>
							</div>
						</div>
						<!-- 年龄 -->
						<div class="weui-cell weui-cell_active">
							<div class="weui-cell__hd"><label class="weui-label">年&nbsp;&nbsp;&nbsp;龄<span class="f-red">*</span></label></div>
							<div class="weui-cell__bd">
								<input id="txt_patient_age" class="weui-input" placeholder="请输入就诊人的年龄"/>
							</div>
						</div>
						<!-- 手机 -->
						<div class="weui-cell weui-cell_active">
							<div class="weui-cell__hd"><label class="weui-label">手&nbsp;&nbsp;&nbsp;机</label></div>
							<div class="weui-cell__bd">
								<input id="txt_patient_phone" class="weui-input" placeholder="请填写可输入的手机号" type="number" pattern="[0-9]*" />
							</div>
						</div>
						<!-- 体重(kg) -->
						<div class="weui-cell weui-cell_active">
							<div class="weui-cell__hd"><label class="weui-label">体&nbsp;&nbsp;&nbsp;重</label></div>
							<div class="weui-cell__bd">
									<input id="txt_patient_weight" class="weui-input" placeholder="请输入就诊人的体重(kg)" type="number" pattern="[0-9]*" />
							</div>
						</div>
						<!-- 职业 -->
						<div class="weui-cell weui-cell_active">
							<div class="weui-cell__hd"><label class="weui-label">职&nbsp;&nbsp;&nbsp;业</label></div>
							<div class="weui-cell__bd">
								<input id="js_input" class="weui-input" placeholder="请输入就诊人的职业"/>
							</div>
						</div>
						<!-- 过敏史 -->
						<div class="weui-cell weui-cell_active">
							<div class="weui-cell__hd"><label class="weui-label">过敏史<span class="f-red">*</span></label></div>
							<div class="weui-cell__bd">
								<input id="txt_allergy_details" class="weui-input" placeholder="请填写就诊人是否有药物过敏史" type="text">
							</div>
						</div>
					</div>
					
				</div>
			</div>
			<br>
			<br>
			<div class="weui-form__opr-area">
				<a class="weui-btn weui-btn_primary weui-btn_disabled" href="javascript:" id="btnInquiry">确定</a>
			</div>
		</div>
	</div>
			

</body>
</html>